GINO Graphics Suite - GINO v9.0  

Polyline Sets

Polyline Set Definition

A polyline set consists of an array of polylines each of which consists of an integer number of vertices and a pointer to an array of 2D vertices.

Each polyline is complete within itself and does not make use of the current pen position. For this reason polygon sets can only use absolute coordinates.

An example of a 2-D polyline set consisting of a trapezium and two triangles is represented by the following coordinates and shown in the diagram below:

  1 2 3 4 5   6 7 8 9   10 11 12 13
                               
x: 40. 160. 340. 460. 40.0   120. 245. 245. 120.   250. 440. 250. 250.
y: 140. 40. 40. 140. 140.   145. 270. 145. 145.   145. 145. 335. 145.
<------------------------------------> <---------------------------> <--------------------------->
Polyline sizes      
  5 4 4
       

Polyline Set

Polyline Usage

Two dimensional polyline sets are drawn using the following routine.

gDrawPolylineSet2D(npol, polylines2)  [F90/C++]
gDrawPolylineSet2D(npol, lverts, xarr, yarr)  [VB.NET]

where npol is the number of polylines contained in the GPOLYGON array polylines2, or in the case of vb.net, all of the vertices are contained in the xarr,yarr arrays and the number of vertices per polygon is contained in the lverts array.

The example polyline sets described previously can be implemented as follows.

[C/C++]
static GPOLYGON poly[3] = {5, 0, 4, 0, 4, 0};
static GPOINT points[13] = {
      40.0,140.0, 160.0,40.0, 340.0,40.0,
      460.0,140.0, 40.0,140.0,
      120.0,145.0, 245.0,270.0, 245.0,145.0, 120.0,145.0
      250.0,145.0, 440.0,145.0, 250.0,335.0, 250.0,145.0};
main()
{
   poly[0].verts=&points[0];
   poly[1].verts=&points[5];
   poly[2].verts=&points[9];

   gDrawPolylineSet2D(3,poly);
}
[F90]
type (GPOLYGON) :: poly(3)
type (GPOINT)   :: points(13) = (/ &
         GPOINT(40.0,140.0), GPOINT(160.0,40.0), &
         GPOINT(340.0,40.0), GPOINT(460.0,140.0), &
         GPOINT(40.0,140.0), &
         GPOINT(120.0,145.0), GPOINT(245.0,270.0), &
         GPOINT(245.0,145.0), GPOINT(120.0,145.0), &
         GPOINT(250.0,145.0), GPOINT(440.0,145.0), &
         GPOINT(250.0,335.0), GPOINT(250.0,145.0) /)
   poly(1)%nvert=5
   poly(1)%verts=>points(1:5)
   poly(2)%nvert=4
   poly(2)%verts=>points(6:9)
   poly(3)%nvert=4
   poly(3)%verts=>points(10:13)
   .
   gDrawPolylineSet2D(3,poly)